<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>逻辑中断</title>
</head>

<body>
    <script>
        let fn = function (x, y) {
            // 可用于设置默认值，一真则真，两假则取最后一个值
            x = x || 0
            y = y || 0
            console.log(x + y)
        }

        fn() // 0
        fn(1) // 1
        fn(1, 2) //3

        // 一假则取假，两真取最后一个
        console.log(undefined && true) // undefined
        console.log(true && undefined) // undefined
        console.log(10 && 20); // 20
    </script>
</body>

</html>